  var host = window.location.host;
console.log(host)
host = host.substring(host.indexOf('.') + 1);
var baseurl='http://139.9.48.147:8605/nw/dl/service/';//农委接口
var baseurl1='https://testdlh5.58yicun.com/yicun/dl/service/';//益村接口
if (host == "58yicun.com"){
    baseurl='http://61.187.51.166:8006/nw/dl/service/';
    baseurl1='https://dl.58yicun.com/yicun/dl/service/';
}
  window.fetch = function(opt, callback, cathCallback) {
      $.ajax({
        type: opt.type || 'POST',
        url:opt.url=='yinong_statisticActive.html'?baseurl+opt.url:baseurl1+opt.url,
        data:opt.data ,
        beforeSend: function(params) {
            
        },
        error: function(err) {
          if(cathCallback) cathCallback(err)
//        Toast('提示', '网络连接异常', 'error')
        },
        success: function(data) {
          var data=JSON.parse(data)
          if(data.errcode == 0&&data.errmsg!=null) {
            callback(data)
          } else {
            if(cathCallback) cathCallback(data)
//          Toast('提示', data.message, 'warning')
          }
        },
        timeout: 5*1000 // 超时时间 30秒
      })
  
  }
  